From ba1971296654c0bbbb30a7b341dda2be44cd87c5 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 18 Aug 2005 15:01:03 +0000 Subject: [PATCH] Fix Xen patches to Linux so that they use pfn_pte() and pfn_pte_ma() constructors, rather than splicing together ptes manually. Not only is this cleaner, it also ensures that the NX/XD bit is safely masked off on systems that do not support it. Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c | 4 ++-- linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c | 4 +--- linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c | 14 ++++---------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c index 381e8e2591..26433a2b67 100644 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c @@ -348,7 +348,7 @@ void xen_create_contiguous_region(unsigned long vstart, unsigned int order) for (i = 0; i < (1<>PAGE_SHIFT)+i); phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn+i; } @@ -395,7 +395,7 @@ void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order) MEMOP_increase_reservation, &mfn, 1, 0) != 1); BUG_ON(HYPERVISOR_update_va_mapping( vstart + (i*PAGE_SIZE), - __pte_ma((mfn<>PAGE_SHIFT)+i); phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn; } diff --git a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c index bf717a8632..ed4822932f 100644 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c @@ -213,9 +213,7 @@ static void balloon_process(void *unused) { BUG_ON(HYPERVISOR_update_va_mapping( (unsigned long)__va(pfn << PAGE_SHIFT), - __pte_ma((mfn_list[i] << PAGE_SHIFT) | - pgprot_val(PAGE_KERNEL)), - 0)); + pfn_pte_ma(mfn_list[i], PAGE_KERNEL), 0)); } /* Finally, relinquish the memory back to the system allocator. */ diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c index eb26470286..c4be747c23 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c @@ -406,21 +406,15 @@ static void dispatch_probe(blkif_t *blkif, blkif_request_t *req) #endif -#ifdef CONFIG_XEN_BLKDEV_TAP_BE if ( HYPERVISOR_update_va_mapping_otherdomain( MMAP_VADDR(pending_idx, 0), - (pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL }, + pfn_pte_ma(req->frame_and_sects[0] >> PAGE_SHIFT, PAGE_KERNEL), +#ifdef CONFIG_XEN_BLKDEV_TAP_BE 0, (blkif->is_blktap ? ID_TO_DOM(req->id) : blkif->domid) ) ) - - goto out; #else - if ( HYPERVISOR_update_va_mapping_otherdomain( - MMAP_VADDR(pending_idx, 0), - (pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL }, - 0, blkif->domid) ) - - goto out; + 0, blkif->domid) ) #endif + goto out; #endif /* endif CONFIG_XEN_BLKDEV_GRANT */ rsp = vbd_probe(blkif, (vdisk_t *)MMAP_VADDR(pending_idx, 0), -- 2.30.2